#include "hjcCommon.h"

namespace util
{
	CCSprite* addSimpleSprite(CCLayer* pLayer, const char* res, float xPercent, float yPercent)
	{
		CCSprite* pSprite = CCSprite::create(res);
		ui::placeUI(pSprite, xPercent, yPercent);
		pLayer->addChild(pSprite);
		return pSprite;
	}
	CCMenu* addSimpleMenu(CCLayer* pLayer, SEL_MenuHandler selector, const char* res1, const char* res2, float xPercent, float yPercent)
	{
		CCSprite* sprite1 = CCSprite::create(res1);
		CCSprite* sprite2 = CCSprite::create(res2);
		CCMenuItemSprite* pMenuItem = CCMenuItemSprite::create(sprite1, sprite2, NULL, pLayer, selector);

		CCMenu* pMenu = CCMenu::create(pMenuItem, NULL);
		pMenu->setPosition( CCPointZero );
		ui::placeUI(pMenuItem, xPercent, yPercent);

		pLayer->addChild(pMenu, 1);
		return pMenu;
	}

	CCMenu* addSimpleMenu(CCLayer* pLayer, SEL_MenuHandler selector, CCSprite* sprite1, CCSprite* sprite2, float xPercent, float yPercent)
	{
		CCMenuItemSprite* pMenuItem = CCMenuItemSprite::create(sprite1, sprite2, NULL, pLayer, selector);

		CCMenu* pMenu = CCMenu::create(pMenuItem, NULL);
		pMenu->setPosition( CCPointZero );
		ui::placeUI(pMenuItem, xPercent, yPercent);

		pLayer->addChild(pMenu, 1);
		return pMenu;
	}
};